import request from '@/utils/request'


export default{
    getEventTypeList(searchModel){
        return request({
            url:'/eventTypes',
            method:'get',
            params:{
                pageNo: searchModel.pageNo,
                pageSize: searchModel.pageSize,
                type: searchModel.type,
            }
        });
    },
    deleteEventTypeById(id){
        return request({
            url:`/eventTypes/${id}`,
            method:'delete',
        })
    },
    getEventTypeById(id){
        return request({
            url:`/eventTypes/${id}`,
            method:'get',
        })
    },
    saveEventType(eventType){
        if(eventType.id == null || eventType.id == undefined){
            return this.addEventType(eventType);
        }else{
            console.log(eventType)
            return this.updateEventType(eventType);
        }
    },
    addEventType(eventType){
        return request({
            url: '/eventTypes',
            method: 'post',
            data: eventType
        });
    },
    updateEventType(eventType){
        return request({
            url: `/eventTypes`,
            method: 'put',
            data: eventType
        });
    },
}